package file;

import java.io.File;

public class fileDemo {
    public static void main(String[] args) {
        File file=new File("./demo.txt");
        //获取文件大小,单位字节
        long len=file.length();
        System.out.println(len+"个字节");

        //获取名字
        String name=file.getName();
        System.out.println(name);

        String str=file.getAbsolutePath();
        System.out.println(str);
        //是否可读
        boolean cr=file.canRead();
        System.out.println("是否可读"+cr);
        //是否可写
        boolean cw=file.canWrite();
        System.out.println("是否可写:"+cw);
        //是否隐藏
        boolean ih=file.isHidden();
        System.out.println("是否隐藏"+ih);

    }
}
